<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" dir="ltr" lang="en-US" xml:lang="en">
<head>

    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=EmulateIE7" />
    <title>Galaxy Explorer (grey) </title>

    <script type="text/javascript" src="../style/GalaxyExplorerHTML/script.js"></script>
	<script type='text/JavaScript' src='scw.js'></script> 
	<script src="../script/scriptaculous-js-1.8.3/lib/prototype.js" type="text/javascript"></script>
    <script src="../script/scriptaculous-js-1.8.3/src/scriptaculous.js" type="text/javascript"></script>

    <link rel="stylesheet" href="../style/GalaxyExplorerHTML/style.css" type="text/css" media="screen" />

	<SCRIPT type="text/javascript">
	 
	 var courant="flecheImage";
	 var lecture=0;
	 
	 function init(){
	 
	 <?php if (!(isset($_COOKIE['login']))): ?>
		deconnect();
	<?php endif; ?>
		
		<?php if(isset ($media)):?>	
			new Effect.Appear('contenu');	
			<?php if ($media["type"]=='audio'):?>
				document.getElementById("contentImage").style.display="none";
				document.getElementById("contentAudio").style.display="block";
				courant="flecheAudio";
				document.getElementById("flecheAudio").src="../image/fleche-a-cote-a-bas-icone-6873-32.png";
				document.getElementById("flecheImage").src="../image/fleche-a-cote-a-droite-icone-6873-32.png";
			<?php endif; ?>
			
			<?php if($media["type"]=='video'):?>
				document.getElementById("contentImage").style.display="none";
				document.getElementById("contentVideo").style.display="block";
				courant="flecheVideo";
				document.getElementById("flecheVideo").src="../image/fleche-a-cote-a-bas-icone-6873-32.png";
				document.getElementById("flecheImage").src="../image/fleche-a-cote-a-droite-icone-6873-32.png";
			<?php endif; ?>
			 
	    <?php endif; ?>
		
		
	}
	
	
	function deconnect(){
		
		
		 document.location.href="<?php echo site_url('connexionUser')?>";		 
		
	 }
	 
	
		
	 
	 
	 function derouler(event){
		
		var select = event.target.id;
		
		if(select!=courant){
			
			if(select == "flecheImage") {document.getElementById("contentImage").style.display="block";new Effect.BlindDown('contentImage');}//document.getElementById("contentImage").style.display="block";
			else if(select == "flecheAudio") {document.getElementById("contentAudio").style.display="block";new Effect.BlindDown('contentAudio');}//document.getElementById("contentAudio").style.display="block";
			else if(select == "flecheVideo") {document.getElementById("contentVideo").style.display="block";new Effect.BlindDown('contentVideo');}//document.getElementById("contentVideo").style.display="block";
			
			if(courant == "flecheImage") document.getElementById("contentImage").style.display="none";
			else if(courant == "flecheAudio")document.getElementById("contentAudio").style.display="none";
			else if(courant == "flecheVideo") document.getElementById("contentVideo").style.display="none";
			
			document.getElementById(select).src="../image/fleche-a-cote-a-bas-icone-6873-32.png";
			document.getElementById(courant).src="../image/fleche-a-cote-a-droite-icone-6873-32.png";
			courant=select;	
		}
		
	 }
	 
	 function afficherMedia(event){
		
		var media = event.target.id;
		document.getElementById('ID_Media').value=media;
		
		document.getElementById('formIDMedia').submit();
	 }
	 
	 function play(){
					
		<?php if (isset($media)):?>
			//document.getElementById("audio").src="../image/medias-lecture-stop-icone-4751-48.png";
			Sound.play("../image/media/<?php echo $media['chemin'];?>",{replace:true});
		<?php endif;?>
		
		
		//document.getElementById("audio").src="../image/medias-lecture-commencez-icone-9398-48.png";
		
		
	 }
	 
	 function stop(){
	 
		//Sound.enable();
		Sound.play('',{replace:true});
		//Sound.disable();
		
	 }
	 
	</SCRIPT>
   
</head>
<body onLoad="init();">

	<div id="art-page-background-simple-gradient"></div>
    
	<div id="art-page-background-glare">
        <div id="art-page-background-glare-image"></div>
    </div>
	
    <div id="art-main">

        <div class="art-Sheet">
            <div class="art-Sheet-tl"></div>
            <div class="art-Sheet-tr"></div>
            <div class="art-Sheet-bl"></div>
            <div class="art-Sheet-br"></div>
            <div class="art-Sheet-tc"></div>
            <div class="art-Sheet-bc"></div>
            <div class="art-Sheet-cl"></div>
            <div class="art-Sheet-cr"></div>

            <div class="art-Sheet-cc"></div>
            <div class="art-Sheet-body">
                <div class="art-nav">
                	<div class="l"></div>
                	<div class="r"></div>
                	<ul class="art-menu">
                		<li>
                			<a href="#" ><span class="l"></span><span class="r"></span><span class="t">Exposition</span></a>
							<ul>
								<li><a href="<?php echo site_url('ajoutExposition')?>">Ajout</a></li>
                				<li><a href="<?php echo site_url('modifExposition')?>">Mes expositions</a></li>
                			</ul>

                		</li>
                		<li>
                			<a href="#" ><span class="l"></span><span class="r"></span><span class="t">Oeuvre</span></a>
                			<ul>
								<li><a href="<?php echo site_url('ajoutOeuvre')?>">Ajout</a></li>
                				<li><a href="<?php echo site_url('ModifOeuvre')?>">Mes oeuvres</a></li>
                			</ul>

                		</li>		
                		<li>
                			<a href="#"class=" active"><span class="l"></span><span class="r"></span><span class="t">Media</span></a>
							<ul>
								<li><a href="<?php echo site_url('ajoutMedia')?>">Ajout</a></li>
                				<li><a href="<?php echo site_url('ModifMedia')?>">Mes medias</a></li>
                			</ul>
							
                		</li>
                	</ul>
                </div>
                <div class="art-Header">
                    <div class="art-Header-jpeg"></div>
                    <div class="art-Logo">
                        <h1 id="name-text" class="art-Logo-name"><a href="#">Gestion des medias</a></h1>
                        <div id="slogan-text" class="art-Logo-text">Mes medias</div>
                    </div>
                </div>
                
                   <div id="conteneur">
				   
				   <?php if (isset($message)) echo $message; ?>
				   
					<form id="formIDMedia" method="post" action="<?php echo site_url('modifMedia')?>" >
						<input name="ID_Media" id="ID_Media" type="hidden"/>
					</form>

						<div class='fichiers'>                       	
                                         
						<div class='bandeau'> <IMG id='flecheImage' class = 'flechemenu' SRC="../image/fleche-a-cote-a-bas-icone-6873-32.png" onClick="derouler(event);"> <h3>Images</h3> </div>
							<div id = 'contentImage'  class='bandeau-content'>
								<div class="art-Block">
								<?php if(isset($images)):?>
									<?php foreach($images as $image):?>
									
										<IMG   class ="bullet" SRC="../image/balle-bleu-diode-led-icone-8413-16.png">
										<div  id="<?php echo $image[0];?>" onclick="afficherMedia(event);" class="art-Block"> <b><?php echo substr($image[1],0,strpos($image[1],'.'));?></b> </div>	
									
									<?php endforeach;?>
								<?php endif;?>
					
								</div>
							</div>
						<div class='bandeau'> <IMG id='flecheAudio' class = 'flechemenu' SRC="../image/fleche-a-cote-a-droite-icone-6873-32.png" onClick="derouler(event);"> <h3>Audios</h3> </div>
						<div id = 'contentAudio' class='bandeau-content' style="display:none">
								<div class="art-Block">
								<?php if(isset($audios)):?>
									<?php foreach($audios as $audio):?>

										<IMG  class ="bullet" SRC="../image/balle-bleu-diode-led-icone-8413-16.png">
										<div id="<?php echo $audio[0];?>" onclick="afficherMedia(event);" class="art-Block" ><b><?php echo substr($audio[1],0,strpos($audio[1],'.'));?></b></div>									 
									<?php endforeach;?>
								<?php endif;?>
								</div>
							</div>
						
						
						<div class='bandeau'> <IMG id='flecheVideo' class = 'flechemenu' SRC="../image/fleche-a-cote-a-droite-icone-6873-32.png" onClick="derouler(event);"> <h3>Video</h3> </div>
							<div id = 'contentVideo' class='bandeau-content'style="display:none" >
								<div class="art-Block">
								<?php if(isset($videos)):?>
									<?php foreach($videos as $video):?>										
										<IMG id="<?php echo $video[0];?>" class ="bullet" SRC="../image/balle-bleu-diode-led-icone-8413-16.png" onclick="afficherMedia(event);">
										<div  class="art-Block" ><b><?php echo substr($video[1],0,strpos($video[1],'.'));?></b></div>									 								    
									<?php endforeach;?>
								<?php endif ;?>
									
								</div>
							</div>			   
						</div>
					
					


					
					<div class='contenu' id='contenu' style="display:none">
					
					<center>
					
					<div class="art-BlockHeader">
						<div class="l"></div>
                        <div class="r"></div>
                        <div class="t"><center><?php if(isset ($media)) echo substr($media['chemin'],0,strpos($media['chemin'],'.')); ?></center></div>
                    </div>
					
					<?php if (isset($media) && $media["type"]=="image"):?>
						<IMG id="image" class ="image" SRC="../image/media/<?php if(isset ($media)) echo $media['chemin'];  ?>" style="height:150px">
					<?php endif; ?>
					
					<?php if (isset($media) && $media["type"]=="audio"):?>
						<IMG id="audio" class ="image" SRC="../image/medias-lecture-commencez-icone-9398-48.png" onclick="play();" >
						<IMG id="audio" class ="image" SRC= "../image/medias-lecture-stop-icone-4751-48.png"onclick="stop();" >
						
					<?php endif; ?>
					
					<br>
					<br>
					<div class="art-BlockHeader">
						<div class="l"></div>
                        <div class="r"></div>
                        <div class="t"><center>Oeuvre associ&eacute</center></div>
                    </div>
					<br>
					
					<form id="formOeuvreMedia" method="post" action="<?php echo site_url('modifMedia')?>" >
					<input name="media" id="media" type="hidden" value="<?php if(isset ($media)) echo $media['id'];?>"/>
					<input name="currentOeuvre" id="currentOeuvre" type="hidden" value="<?php if(isset ($media)) echo $media['oeuvre'];?>"/>
					<SELECT name ="oeuvre" >
						<OPTION value=0 > aucune...
						<?php if(isset ($oeuvres)): ?>
						<?php foreach($oeuvres as $oeuvre):?>
							<OPTION value =<?php echo $oeuvre[0];?> <?php if (isset($media)) if ($media['oeuvre'] == $oeuvre[0]) echo "selected"; ?>><?php echo $oeuvre[1];?>
						<?php endforeach;?>
						<?php endif; ?>
					</SELECT>
					<hr/>

					<div id="validation">																							
					<center><input name="modifier" class="art-button" type=submit value="Modifier"> <input class="art-button" type=reset value="Supprimer"></center>
					</div>
					
					</div>
                    </form>  
					</center>
					<div id="bas"></div>
			                                          		
                     </div>      
                                              
                     
                         
			    <div class="cleared"></div>				
           			

			<div class="cleared"></div>
			<div class="art-Footer">
                <div class="art-Footer-inner">
				<div class="art-Footer-text">
							<IMG class ="user" SRC="../image/lhomme-personnes-personne-utilisateur-icone-6535-32.png">					
                            <p><?php  echo $_COOKIE['login'];?></p>
							
                       </div>
						<IMG id ="fermer" SRC="../image/bye-shutdown-icone-5302-16.png" onclick="deconnect();">
				</div>
                <div class="art-Footer-background"></div>
            </div>
       		<div class="cleared"></div>
			</div>
			<div class="cleared"></div>
			<p class="art-page-footer"></p>  
		</div>
	</div>
	
</body>

</html>
